Easy2Siksha.com
Conclusion
Queues are one of the simplest yet most powerful data structures. Their linked
representation makes them flexible, allowing dynamic growth without worrying about fixed
sizes. By mastering operations like enqueue and dequeue, we can handle real-world
problems like scheduling tasks, managing printers, or simulating waiting lines.
In essence, queues teach us the importance of order and fairness—just like in life, those
who come first should be served first.
5. What is Bubble Sort ? Consider the following numbers are stored in an array A: 37, 52,
28, 75, 61, 24, 9, 59. Apply Bubble sort algorithm to the array A and show each pass
separately.
Ans: What is Bubble Sort?
Imagine you have a row of students standing randomly based on height, but you want them
to stand in ascending order—from the shortest to the tallest. Instead of asking everyone to
rearrange themselves at once, you tell them to check one pair at a time:
• Compare Student 1 with Student 2.
• If Student 1 is taller, swap them.
• Then compare Student 2 with Student 3, and swap if needed.
• Continue till the end.
At the end of this first round, the tallest student naturally moves to the last position—just
like a bubble floating to the top of water.
That’s why we call it Bubble Sort.
Bubble Sort works by repeatedly comparing adjacent elements (side-by-side), and swapping
them if they are in the wrong order. After each full pass, the largest remaining number
"bubbles up" to its correct position.
Given Data
You are asked to apply Bubble Sort on the following array:
A = [37, 52, 28, 75, 61, 24, 9, 59]
We will sort it in ascending order.
Now let’s walk through the passes one by one.